﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kugar.Core.Security
{
    [Serializable]
    public class RMS_PermissionItemValue : RMS_PermissionItem
    {
        /// <summary>
        ///     允许一个权限子项可以设置其他值，比如可以用于对应枚举类型<br/>
        ///    但是，规定该属性值为0时，为不拥有该权限
        /// </summary>
        public int ControlValue { set; get; }

        public static RMS_PermissionItemValue Load(RMS_PermissionItem src)
        {
            var temp = new RMS_PermissionItemValue();

            temp.PermissionID = src.PermissionID;
            temp.PermissionName = src.PermissionName;
            temp.CategoryID = src.CategoryID;
            temp.ControlValue = 0;

            return temp;
        }

        public bool HasPermission { get { return ControlValue > 0; } }
    }
}
